.col-md-12
  - if @metadata.present?
    .card.mb-3
      .card-header
        h3.card-title
          i.icon.fa-solid.fa-history
          = t('teardowns.index.upload_history')
      .card-body.p-0
        table.table.table-bottom-borderless
          tr
            th = t('teardowns.index.app_name')
            th = t('teardowns.index.version')
            th = t('teardowns.index.platform')
            th.d-none.d-sm-table-cell = t('teardowns.index.uploader')
            th style="width: 160px" = t('teardowns.index.uploaded_at')
            - if user_signed_in? && @metadata.any? { |md| current_user&.manage?(app: md.app) || current_user == md.user }
              th.d-none.d-sm-table-cell style="width: 90px" = t('teardowns.index.actions')
          - @metadata.each_with_index do |md, index|
            tr
              td
                = link_to (md.name || '-'), teardown_path(md)
              td
                - if md.release_version.present?
                  = md.release_version
                  - if md.build_version.present?
                    | (#{md.build_version})
                - else
                  | -
              td
                = platform_name(md.platform)
              td.d-none.d-sm-table-cell
                = md.user&.username || t('teardowns.index.anonymous')
              td
                span data-bs-toggle="tooltip" data-bs-custom-class="default-tooltip" title="#{l(md.created_at, format: :nice)}"
                  = time_ago_in_words(md.created_at)

              - if user_signed_in? && (md.user == current_user || current_user&.manage?(app: md.app))
                td.d-none.d-sm-table-cell
                  = button_link_to '', teardown_path(md), 'trash-alt', \
                    class: 'btn btn-tool', data: { \
                      turbo_method: :delete, \
                      turbo_confirm: t('modals.confirm.body'), \
                    }

      - if @metadata.total_pages > 1
        .card-footer.clearfix
          .float-end
            = paginate @metadata
  - else
    .card.card-outline.card-warning.mb-3
      .card-header.card-border
        h3.card-title = t('teardowns.index.not_found.title')
      .card-body = t('teardowns.index.not_found.body_html')

